﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

using YEngineLib;

namespace Spyfall.Managers
{
    class GameManager
    {
        private static GameManager s_Instance;

        public static GameManager GetInstance
        {
            get
            {
                if (s_Instance == null)
                    s_Instance = new GameManager();
                return s_Instance;
            }
        }

        private float speed = 200;

        public float Speed
        {
            get { return speed; }
            set { speed = value; }
        }
        private float dashSpd = 400;

        public float DashSpd
        {
            get { return dashSpd; }
            set { dashSpd = value; }
        }
        private float dashLength = 160;

        public float DashLength
        {
            get { return dashLength; }
            set { dashLength = value; }
        }

        private int coins = 0;

        public int Coins
        {
            get { return coins; }
            set { coins = value; }
        }


        public void SaveGame()
        {
        }

        public void LoadGame()
        {
        }

        public void LoadLevel(int Level)
        {

            LevelManager.GetInstance.Background = YEngine.Game.Content.Load<Texture2D>("Graphics/spyfallbg");
            LevelManager.GetInstance.SpeedUpNum = 3;
            if (Level == 1)
            {
                LevelManager.GetInstance.SpawnRate = 2.0f;
                LevelManager.GetInstance.SpeedUpSpawn = 5.0f;
                LevelManager.GetInstance.Length = 60;
            }
            else if (Level == 2)
            {
                LevelManager.GetInstance.SpawnRate = 1.8f;
                LevelManager.GetInstance.SpeedUpSpawn = 5.0f;
                LevelManager.GetInstance.Length = 60;
            }
            else if (Level == 3)
            {
                LevelManager.GetInstance.SpawnRate = 1.6f;
                LevelManager.GetInstance.SpeedUpSpawn = 7.0f;
                LevelManager.GetInstance.Length = 80;
            }
            else if (Level == 4)
            {
                LevelManager.GetInstance.SpawnRate = 1.6f;
                LevelManager.GetInstance.SpeedUpSpawn = 7.5f;
                LevelManager.GetInstance.Length = 90;
            }
            else if (Level == 5)
            {
                LevelManager.GetInstance.SpawnRate = 1.5f;
                LevelManager.GetInstance.SpeedUpSpawn = 9.0f;
                LevelManager.GetInstance.Length = 100;
            }
            else if (Level == 6)
            {
                LevelManager.GetInstance.SpawnRate = 1.3f;
                LevelManager.GetInstance.SpeedUpSpawn = 9.0f;
                LevelManager.GetInstance.Length = 110;
            }
            else if (Level == 7)
            {
                LevelManager.GetInstance.SpawnRate = 1.3f;
                LevelManager.GetInstance.SpeedUpSpawn = 9.5f;
                LevelManager.GetInstance.Length = 120;
            }
            else if (Level == 8)
            {
                LevelManager.GetInstance.SpawnRate = 1.2f;
                LevelManager.GetInstance.SpeedUpSpawn = 10.0f;
                LevelManager.GetInstance.Length = 120;
            }
            else if (Level == 9)
            {
                LevelManager.GetInstance.SpawnRate = 1.0f;
                LevelManager.GetInstance.SpeedUpSpawn = 10.0f;
                LevelManager.GetInstance.Length = 120;
            }
            else if (Level == 10)
            {
                LevelManager.GetInstance.SpawnRate = 1.0f;
                LevelManager.GetInstance.SpeedUpSpawn = 15.0f;
                LevelManager.GetInstance.Length = 120;
            }
        }
    }
}
